home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 197 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  3.6 KB

  1. From: beman@dawes.win.net (Beman Dawes)
  2. Message-ID: <1198@dawes.win.net>
  3. X-Original-Date: Tue, 30 Jan 1996 17:14:07
  4. Path: in2.uu.net!bounce-back
  5. Date: 01 Feb 96 01:32:27 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Organization: -
  8. Newsgroups: comp.std.c++
  9. X-Mailer: WinNET Mail, v2.61
  10. Reply-To: beman@dawes.win.net (Beman Dawes)
  11. Subject: Re: and, or, not
  12. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  13.     iQBFAgUBMRAYQOEDnX0m9pzZAQE6fQF+ORhKNiE4Ha9vUIWEPVwBPmqqBz+qh1Xk
  14.     +KIOY6/CReNpDGm7tYvF3hcd1fw136SQ
  15.     =7iv8
  16.  
  17. In article <4ej3t4$7nb@jupiter.SJSU.EDU>, Cay S. Horstmann
  18.  (horstman@jupiter.SJSU.EDU) writes:
  19.  
  20. >I just got a press release from Borland that says their upcoming 5.0
  21. >compiler will support keywords and, or, not, that are synonyms to &&,
  22. >|| and !. 
  23. >
  24. >They say you can use those if your local keyboard makes it difficult
  25. >to write the traditional tokens. Hell, my local eyes make it difficult
  26. >to read them. Does that mean I can from now on just write
  27. >       if (0 <= x and x <= 1) . . .
  28. >and be in conformance with ANSI C++?
  29. >
  30. >That is, are "and", "or", "not", now reserved words in ALL C++
  31. >programs, or do you actually have to reside in a foreign country and
  32. >first use some preprocessor (like that trigraph filter) to get them?
  33. >
  34. >If the answer is "they are reserved words in the language", then I'll
  35. >add
  36. >       #define and &&
  37. >       #define or ||
  38. >       #define not !
  39. >into my personal setup file today, until my compiler understands them
  40. >natively. Hooray!
  41.  
  42. Funny you should ask.  I just looked it up this morning:
  43.  
  44.   2.9  Keywords                                                [lex.key]
  45.  
  46. 1 The identifiers shown in Table 3 are reserved for use as keywords, and
  47.   shall not be used otherwise in phases 7 and 8:
  48.  
  49.                             Table 3--keywords
  50.  
  51.   +--------------------------------------------------------------------------+
  52.   |asm          do             inline             short         typeid       |
  53.   |auto         double         int                signed        typename     |
  54.   |bool         dynamic_cast   long               sizeof        union        |
  55.   |break        else           mutable            static        unsigned     |
  56.   |case         enum           namespace          static_cast   using        |
  57.   |catch        explicit       new                struct        virtual      |
  58.   |char         extern         operator           switch        void         |
  59.   |class        false          private            template      volatile     |
  60.   |const        float          protected          this          wchar_t      |
  61.   |const_cast   for            public             throw         while        |
  62.   |continue     friend         register           true                       |
  63.   |default      goto           reinterpret_cast   try                        |
  64.   |delete       if             return             typedef                    |
  65.   +--------------------------------------------------------------------------+
  66.  
  67. 2 Furthermore, the alternative representations shown in Table 4 for cer-
  68.   tain  operators and punctuators (_lex.digraph_) are reserved and shall
  69.   not be used otherwise:
  70.  
  71.                    Table 4--alternative representations
  72.  
  73.             +------------------------------------------------+
  74.             |and      and_eq   bitand   bitor   compl    not |
  75.             |not_eq   or       or_eq    xor     xor_eq       |
  76.             +------------------------------------------------+
  77.  
  78. --Beman
  79. ---
  80. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  81.   Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  82.   is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
  83.